package de.sas.za_expression.model;

public abstract class Expression {
	
	
	
	abstract public boolean evaluate() throws Exception;
	
	public boolean and(Expression rightSide) throws Exception
	{
		if (this.evaluate() && rightSide.evaluate())
			return true;
		else
			return false;
	}
	
	public boolean or(Expression rightSide) throws Exception
	{
		if (this.evaluate() || rightSide.evaluate())
			return true;
		else
			return false;
	}
	
	public boolean xor(Expression rightSide) throws Exception
	{
		if ((this.evaluate() && !rightSide.evaluate()) || (!this.evaluate() && rightSide.evaluate()))
			return true;
		else
			return false;
	}
	
}
